<?php 
include('header.php');
include('menu.php');
include('config.php');
include_once('connection/connection.php');
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
}
$sc = "";
if(isset($_POST['submit']))
{ 
	$District_id=$_POST['district'];
	//$_SESSION['district']=$district;
	$Block_id=$_POST['form_id'];
	//$_SESSION['form_id']=$form_id;
	$sc="RWSS";
	if($sc=="RWSS")
	{
		header('Location:ListRWSSscheme.php?DT='.$District_id.'&TS='.$sc.'');
	}
	
}	
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/validate.js"></script>
<script language="javascript" type="text/javascript">
function validate()
{
	valid = true;
	if (document.view_main_q1.district.selectedIndex == 0)
    {
        alert ( "Please select District Name" );
        valid = false;
    }
	if (document.view_main_q1.form_id.selectedIndex == 0)
    {
        alert ( "Please select Form Id" );
        valid = false;
    }
	return valid;
}	
</script>
<title>P&T</title>
</head>
<body>
<div align="center">
<form action="" method="post" enctype="multipart/form-data" onSubmit="return validate()" name="view_main_q1">
<table border="0" width="746" id="table1" cellspacing="0" cellpadding="0" style="padding:10px;">
	<tr>
		<td height="29" align="left" valign="top" bgcolor="#C5D8EB" colspan="3">&nbsp;</td>
	</tr>
	<tr>
	<td bgcolor="#E5E5E5" align="center" colspan="3" style="padding-top:5px">
	<span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size: 8.5pt"><font face="Verdana" color="#006699"><b>RWSS scheme wise list</b></font></span></td>
</tr>
<tr><td bgcolor="#E5E5E5" align="left" colspan="3">&nbsp;</td>
</tr>
<tr><td align="left" colspan="3">&nbsp;</td>
</tr>
		<tr>
			<td width="225" height="27" align="right">
					<font face="Verdana" style="font-size: 8.5pt" color="#000000">District&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
			<td width="173">
			<?php
		  echo "<select name='district' id='district' class='txt' onChange=\"changeForm('form_id',this.value,'$sc')\">\n";
          echo "<option value='0'>==== District ====</option>\n";
		  $query="select DISTINCT district_id from tbl_dtls_q1_main where type_scheme='RWSS'";
		  $result=mysql_query($query);
		  $dist_name = array();
		  while(list($id)=mysql_fetch_array($result))
		   {
            $dist_name[$id]=getName('district',$id);
           }
		  asort($dist_name);
		  
           foreach($dist_name as $id=>$val)
		       {
			   $take="";
			  $individual=explode(",",$id);
			  foreach($individual as $myid)
			  {
			  $take[]=getName('district',$myid);
			  }
			  
			  $individual=implode($take,",");
                echo "<option value=\"$id\">".$individual."</option> \n" ;
				  }
		  echo "</select>";
		  ?>
			</td>
			<td width="348"><input type="submit" value="view" name="submit"  onClick="view_validate()"></td>
		</tr>
		<tr>
			<td colspan="3">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="3">&nbsp;</td>
		</tr>
		
		<tr>
			<td colspan="3">
		</td>
		</tr>
	</table>
</form>
</div>
</body>
</html>
